/*
 * @Author: 姚京建
 * @Date: 2022-08-11 09:34:22
 * @LastEditors: 姚京建
 * @LastEditTime: 2022-08-24 14:29:26
 * @FilePath: /cms-pk/src/assets/js/config.js
 * @Description:
 */
/**
 * @Author: 焦质晔
 * @Date: 2019/6/20
 * @Last Modified by:   焦质晔
 * @Last Modified time: 2019-06-20 15:45:00
 */
const createProductEnv = env => {
  const result = {
    env,
    envText: `当前工程环境：${env}`,
    serverUrl: '/',
    uploadUrl: '',
    gucUrl: 'http://localhost:8080/login',
    goUrl: '',
    isGoLogin: false,
    gucServer: 'https://guc3-api-test.radar-ev.com',
    gucEnv: 'uat',
    waterMarkEnv:'内部开发环境',
    gucAppid: '10000150',
    client_id: 'a30235daf910ce4a9cfa3f1d3693eeb211c4',
    secret: '59050196aa96394069a8a04b4689a218c45e'
  };
  if (env === 'development') {
    result.serverUrl = '/';
    result.gucServer = 'https://guc3-api-test.radar-ev.com';
  } else {
    console.log = console.warn = console.info = () => {};
    result.serverUrl = '/';
  }
  const _origin = window.location.origin;
  let domain = result.serverUrl;
  if ('http://dcs-test.c1e3f60fe9e324718885b70ba971f2783.cn-hangzhou.alicontainer.com' == _origin) {
    domain = 'http://test-dms-api.c1e3f60fe9e324718885b70ba971f2783.cn-hangzhou.alicontainer.com';
  }
  if ('http://dcs-test.radar-ev.com' == _origin) {
    domain = 'http://dcs-test-api.radar-ev.com';
    result.uploadUrl = 'http://dcs-test-api.radar-ev.com';
    result.gucUrl = 'http://dcs-test.radar-ev.com/login';
    result.waterMarkEnv = '内部测试环境';
  }
  if ('https://dcs-test.radar-ev.com' == _origin) {
    domain = 'https://dcs-test-api.radar-ev.com';
    result.uploadUrl = 'https://dcs-test-api.radar-ev.com';
    result.gucUrl = 'https://dcs-test.radar-ev.com/login';
    result.waterMarkEnv = '内部测试环境';
  }
  if ('https://dcs.uat.radar-ev.com' == _origin) {
    domain = 'https://dcs-api.uat.radar-ev.com';
    result.uploadUrl = 'https://dcs-api.uat.radar-ev.com';
    result.gucUrl = 'https://dcs.uat.radar-ev.com/login';
    result.gucEnv = 'pro';
    result.waterMarkEnv = '用户测试环境';
    result.client_id = '96f34052c469684eb2188f5b14eef7867c9f';
    result.secret = 'fa9f88cf27c9404bcf38c11e0082c1950700';
  }

  if ('https://dcs.radar-ev.com' == _origin) {
    domain = 'https://dcs-api.radar-ev.com';
    result.uploadUrl = 'https://dcs-api.radar-ev.com';
    result.gucUrl = 'https://dcs.radar-ev.com/login';
    result.gucServer = 'https://guc-api.radar-ev.com';
    result.gucEnv = 'pro';
  }

  if ('http://go-uat.radar-ev.com' == _origin || 'https://go-uat.radar-ev.com' == _origin || 'http://go-test.radar-ev.com' == _origin || 'https://go-test.radar-ev.com' == _origin) {
    result.goUrl = 'https://dcs-test-api.radar-ev.com';
    result.isGoLogin = true;
  }

  if ('http://dcs-test.evun.cn' == _origin) {
    domain = 'http://dcs-test-api.evun.cn';
    result.uploadUrl = 'http://dcs-test-api.evun.cn';
    result.gucUrl = 'http://dcs-test.evun.cn/login';
    result.gucServer = 'https://guc3-api.test.evun.cn';
  }

  if ('http://dcs.uat.evun.cn' == _origin) {
    domain = 'http://dcs-api.uat.evun.cn';
    result.uploadUrl = 'http://dcs-api.uat.evun.cn';
    result.gucUrl = 'http://dcs.uat.evun.cn/login';
    result.gucServer = 'https://guc3-api.test.evun.cn';

    result.client_id = '96f34052c469684eb2188f5b14eef7867c9f';
    result.secret = 'fa9f88cf27c9404bcf38c11e0082c1950700';
  }

  if ('http://dcs.evun.cn' == _origin) {
    domain = 'http://dcs-api.evun.cn';
    result.uploadUrl = 'http://dcs-api.evun.cn';
    result.gucUrl = 'http://dcs.evun.cn/login';
    result.gucServer = 'https://guc-api.radar-ev.com';
  }

  if ('https://dcs-test.evun.cn' == _origin) {
    domain = 'https://dcs-test-api.evun.cn';
    result.uploadUrl = 'https://dcs-test-api.evun.cn';
    result.gucUrl = 'https://dcs-test.evun.cn/login';
    result.gucServer = 'https://guc3-api.test.evun.cn';
  }

  if ('https://dcs.uat.evun.cn' == _origin) {
    domain = 'https://dcs-api.uat.evun.cn';
    result.uploadUrl = 'https://dcs-api.uat.evun.cn';
    result.gucUrl = 'https://dcs.uat.evun.cn/login';
    result.gucServer = 'https://guc3-api.test.evun.cn';

    result.client_id = '96f34052c469684eb2188f5b14eef7867c9f';
    result.secret = 'fa9f88cf27c9404bcf38c11e0082c1950700';
  }

  if ('https://dcs.evun.cn' == _origin) {
    domain = 'https://dcs-api.evun.cn';
    result.uploadUrl = 'https://dcs-api.evun.cn';
    result.gucUrl = 'https://dcs.evun.cn/login';
    result.gucServer = 'https://guc-api.radar-ev.com';
  }

  result.serverUrl = domain;
  return result;
};

export default createProductEnv(process.env.NODE_ENV);
